<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
  <meta>
    <author>Ext JS, Inc.</author>
  </meta>
  <bindings>
    <select itemPath="result.vote" produces="XML">
      <urls>
        <url>http://www.govtrack.us/congress/votes_download_xml.xpd</url>
      </urls>
      <inputs>
          <key id='person' type='xs:string' paramType='query' required="true" />
          <key id='fts' type='xs:string' paramType='query' required="false" />          
      </inputs>
      <execute><![CDATA[
        fts = fts || false;
        if (fts) {
           fts = fts.replace('%20', ' ');
        }
        var results = request.get().response;
        results = y.xmlToJson(results);
        results = results["votes-download"].votes;
        
        var vote = [];
        if (fts && results && results.vote) {   
            for (var i = 0, ln = results.vote.length; i < ln; i++) {
                if (results.vote[i].description.indexOf(fts) !== -1) {
                    vote.push(results.vote[i]);
                }
            }
            results.vote = vote;
        }
        response.object = results;
]]></execute>
    </select> 
  </bindings>
</table>